using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class Msg_record_detailMap : EntityTypeConfiguration<Msg_record_detail>
    {
        public Msg_record_detailMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Msg_Record_Id, t.sms_seq_id });

            // Properties
            this.Property(t => t.Msg_Record_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.sms_seq_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.destination)
                .HasMaxLength(4000);

            this.Property(t => t.State_desc)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Msg_record_detail");
            this.Property(t => t.Msg_Record_Id).HasColumnName("Msg_Record_Id");
            this.Property(t => t.sms_seq_id).HasColumnName("sms_seq_id");
            this.Property(t => t.destination).HasColumnName("destination");
            this.Property(t => t.State_value).HasColumnName("State_value");
            this.Property(t => t.State_desc).HasColumnName("State_desc");
            this.Property(t => t.DoneTime).HasColumnName("DoneTime");

            // Relationships
            this.HasRequired(t => t.Msg_record_detail2)
                .WithOptional(t => t.Msg_record_detail1);

        }
    }
}
